home *** CD-ROM | disk | FTP | other *** search
- Path: ssc.sas.upenn.edu!modavis
- From: modavis@ssc.sas.upenn.edu (Morris A. Davis)
- Newsgroups: comp.lang.c
- Subject: Re: Math Functions
- Date: 6 Feb 1996 17:35:54 GMT
- Organization: University of Pennsylvania
- Distribution: world
- Message-ID: <4f83hq$mva@netnews.upenn.edu>
- References: <4f7m6m$b4j@server1.ctc.com>
- NNTP-Posting-Host: ssc.sas.upenn.edu
- X-Newsreader: TIN [version 1.2 PL2-upenn1.1]
-
- Matt Cunningham (cunning@CTC.COM) wrote:
- : I'm trying to find out if I can do matrix math using C. I am working on the
- : SGI platform (Irix 5.3) and I want to know if I can do complex numbers,
- : define matrices, take the determinant of matrices etc. Any ideas of if I
- : can do this and how?
-
- 1. You can define matrices in C
- double mymatrix[10][20];
- initializes a double precision 10x20 matrix called "mymatrix"
- 2. If you buy book "Numerical Recipes in C", you'll find a nice listing
- for the Gauss-Jordan decomposition (matrix inversion/solution to a
- system of equations....). There's a big fixed cost to entering in this
- program yourself (you have to type in a very long include file...)
- 3. I don't know about complex numbers. In the K&R book, the sqrt(x)
- is defined with the listing x>=0 (p.251). I'm sure with clever
- programming and checks, you can remember which square roots should have
- the "i" and which shouldn't.
-
- I'll get flamed for this, but:
- May I suggest, however, that you think about using MATLAB for your
- matrix needs. MATLAB is much slower than C, however. (that may change
- soon with the intrduction of a Matlab to C compiler). If you really
- need speed, you can't go with MATLAB. If speed is a secondary issue,
- you might think about using MATLAB.
-
- Regards, Morris
-
- : Thanks
-
- : --
- : Matt Cunningham
- : (814) 269-2695
- : Associate Software Engineer
- : Concurrent Technologies Corporation
-